package com.penfei.springrun.controller


import com.penfei.springrun.Service.UserService
import com.penfei.springrun.result.ResponseResult
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.stereotype.Controller
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.ResponseBody
import java.util.*

@Controller
@RequestMapping("/user")
class UserDatabase {

    @Autowired
    var userService: UserService? = null

    @RequestMapping("/dbGet")
    @ResponseBody
    fun dbGet(): ResponseResult {
        return ResponseResult.success(userService!!.getById("1"))
    }

    @RequestMapping("/dbModify")
    @ResponseBody
    fun dbModify(id: String?, phone: String?, password: String?, userName: String?): ResponseResult {
        userService!!.updateUser(id, phone, password, userName, "")
        return ResponseResult.success(true)
    }
}